-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaced invocation #16319
Namespaced invocation #16319
Conversation
ad81146
to
05c4ada
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good! Only had a few inline comments
packages/container/lib/container.js
Outdated
// pass it to the resolve without the source | ||
normalizedName = expandedFullName; | ||
options = {}; | ||
if (!EMBER_MODULE_UNIFICATION) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be passed to the assertion below (instead of a separate conditional)
packages/container/lib/container.js
Outdated
let normalizedName = fullName; | ||
if (options.source) { | ||
let expandedFullName = container.registry.expandLocalLookup(fullName, options); | ||
if (!EMBER_MODULE_UNIFICATION) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be part of assertion condition
if (helper !== undefined) { | ||
return helper; | ||
} | ||
|
||
const { owner, moduleName } = meta; | ||
|
||
const options: LookupOptions | undefined = makeOptions(moduleName); | ||
const {name, namespace} = this._parseNameForNamespace(_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you guard this in the feature flag?
} | ||
|
||
private _lookupComponentDefinition(_name: string, meta: OwnedTemplateMeta): Option<ComponentDefinition> { | ||
let {name, namespace} = this._parseNameForNamespace(_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please guard this in the feature flag?
if (namespaceDelimiterOffset === -1) { | ||
this.name = name; | ||
this.namespace = undefined; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s tweak this else case to ensure it’s feature flagged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already guarded in: https://github.com/emberjs/ember.js/pull/16240/files#diff-11c397e816cb737423d40c0a91104f5fR40
packages/ember-runtime/lib/inject.js
ensures that options
is only passed if the feature flag is enabled 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you
39bdf15
to
404ca53
Compare
404ca53
to
e4fab05
Compare
Replaces #16158
This commit adds support for invoking a component or injecting a service from a module unification namespace. It is in alignment with RFC #309.
Use
::
to delimit namespaces from the name of an invocation or injection. For example: